#include	"VectorRotate.h"
#include	"Vector3f.h"
#include	"Vector3d.h"
#include	<cmath>

Vector3f RotateX(const Vector3f & vector, float angleRadians)
{
	const float cosA = std::cos(angleRadians);
	const float sinA = std::sin(angleRadians);
	return Vector3f(
		vector[0],
		vector[1] * cosA + vector[2] * sinA,
		vector[2] * cosA - vector[1] * sinA);
}

Vector3f RotateY(const Vector3f & vector, float angleRadians)
{
	const float cosA = std::cos(angleRadians);
	const float sinA = std::sin(angleRadians);
	return Vector3f(
		vector[0] * cosA - vector[2] * sinA,
		vector[1],
		vector[2] * cosA + vector[0] * sinA);
}

Vector3f RotateZ(const Vector3f & vector, float angleRadians)
{
	const float cosA = std::cos(angleRadians);
	const float sinA = std::sin(angleRadians);
	return Vector3f(
		vector[0] * cosA + vector[1] * sinA,
		vector[1] * cosA - vector[0] * sinA,
		vector[2]);
}

Vector3d RotateX(const Vector3d & vector, double angleRadians)
{
	const double cosA = std::cos(angleRadians);
	const double sinA = std::sin(angleRadians);
	return Vector3d(
		vector[0],
		vector[1] * cosA + vector[2] * sinA,
		vector[2] * cosA - vector[1] * sinA);
}

Vector3d RotateY(const Vector3d & vector, double angleRadians)
{
	const double cosA = std::cos(angleRadians);
	const double sinA = std::sin(angleRadians);
	return Vector3d(
		vector[0] * cosA - vector[2] * sinA,
		vector[1],
		vector[2] * cosA + vector[0] * sinA);
}

Vector3d RotateZ(const Vector3d & vector, double angleRadians)
{
	const double cosA = std::cos(angleRadians);
	const double sinA = std::sin(angleRadians);
	return Vector3d(
		vector[0] * cosA + vector[1] * sinA,
		vector[1] * cosA - vector[0] * sinA,
		vector[2]);
}


